

const fs = require('fs')

const readStream = fs.createReadStream('data/data.json', { encoding: "utf8" })

// const writeStream = fs.createWriteStream('data/data1.json', { encoding: "utf8" })
const writeStream = fs.createWriteStream('data/data2.json.gz', { encoding: "utf8" })

const zlib = require('zlib')

readStream
    .pipe(zlib.createGzip())
    .pipe(writeStream)